﻿using Dapper.DBContext.Schema;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Guoc.BigMall.Domain.Entity
{
    [Table("transaction_history")]
    /// <summary>
    ///  交易记录
    /// </summary>
    public class TransactionHistory : BaseEntity
    {
        public TransactionHistory()
        {
            this.CreatedOn = DateTime.Now;
            this.TradeDate = CreatedOn;
        }

        public TradeType TradeType { get; set; }

        /// <summary>
        /// 使用类静态 TradeKeyName：  saleorder.begin.pay
        /// </summary>
        public string TradeKey { get; set; }
        /// <summary>
        ///  交易动作名称
        /// </summary>
        public string TradeName { get; set; }
       
        /// <summary>
        /// 内部交易单号： 如销售单号
        /// </summary>
        public string TradeCode { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public decimal TradeAmount { get; set; }

        /// <summary>
        ///  外部交易号，如微信支付单号
        /// </summary>
        public string OutTradeNo { get; set; }

        public DateTime CreatedOn { get; set; }
        /// <summary>
        ///  交易日期： 支付企业完成操作日期
        /// </summary>
        public DateTime TradeDate { get; set; }

        /// <summary>
        ///  交易原始报文
        /// </summary>
        public string TradeContent { get; set; }
    }


    public enum TradeType
    {
        [Description("订单支付")]
        OrderPay = 1,
        [Description("订单退款")]
        OrderRefund =2,
        [Description("提现到支付宝")]
        CashToAlipay =3,
        [Description("提现到微信")]
        CashToWechat =4,
    }

   /// <summary>
   ///  交易key
   /// </summary>
    public class TradeKeyName {
        /// <summary>
        ///  微信统一下单
        /// </summary>
        public static readonly string Wechat_Untified_Trade = "wechat.unitifed.trade";
        /// <summary>
        ///  微信支付通知
        /// </summary>
        public static readonly string Wechat_Pay_Notify = "wechat.pay.notify";

        /// <summary>
        /// 单笔转账接口
        /// </summary>
        public static readonly string Alipay_Uni_Transfer = "alipay.fund.trans.uni.transfer";

        public static readonly string Wechat_transfers = "wechat.transfers";


    }
}
